import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common'
import { WireService } from './wire.service'
import { CreateWireDto } from './dto/create-wire.dto'
import { UpdateWireDto } from './dto/update-wire.dto'

@Controller('wire')
export class WireController {
  constructor(private readonly wireService: WireService) {}

  @Post()
  create(@Body() createWireDto: CreateWireDto) {
    return this.wireService.create(createWireDto)
  }

  @Get()
  async findAll(@Query() args = {}) {
    return await this.wireService.findAll(args)
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.wireService.findOne(+id)
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateWireDto: UpdateWireDto) {
    return this.wireService.update(+id, updateWireDto)
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.wireService.remove(+id)
  }

  @Delete('/wires/:id')
  async removeAll(@Param('id') id: string) {
    return await this.wireService.removeAll(+id)
  }
}
